﻿@using System.Text
@using OA.Model
@using OA.AspNetCore.Html
@using OA.Core.Model
@using OA.Core.Helper

@model PageList<SimpleVote>
@{
    ViewBag.Title = "投票列表";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}


<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: auto; padding-right: 5px;">名称筛选：</label>
                <div class="layui-input-inline">
                    <input type="text" name="keyWord" class="layui-input" value="@ViewBag.Keyword">
                </div>
                <button type="button" class="layui-btn searchButton">搜索</button>
                <a class="layui-btn" href="javascript:ShowPage('/Management/Vote/Create','添加投票',7)">添加投票</a>
            </div>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:15}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'ID', width:70}">编号</th>
                <th lay-data="{field:'Title'}">名称</th>
                <th lay-data="{field:'StartTime', width:170}">开始时间</th>
                <th lay-data="{field:'EndTime', width:170}">结束时间</th>
                <th lay-data="{fixed:'right', width:180, align:'center', toolbar: '#barDemo',width:480}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">

        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/Vote/ShowVote?id={{d.ID}}','查看投票')">查看</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/Vote/Statistics?id={{d.ID}}','查看统计')">查看统计</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/Vote/SetEmployees?id={{d.ID}}','指定填报成员')">指定填报成员</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/Vote/Edit?id={{d.ID}}','修改投票',7)">修改投票</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/Vote/ShowItems?id={{d.ID}}','编辑表单项')">编辑表单项</a>
        <span class="layui-btn layui-btn-primary layui-btn-xs" onclick="DeleteItem('{{d.ID}}')">删除</span>

    </script>
        
</div>
<script type="text/javascript">
    function DeleteItem(id) {
        layer.confirm('您正在进行删除投票操作', {
            btn: ['是的,我要删除该投票', '不小心点错了'] //按钮
        }, function () {
            var url = "/Management/Vote/Delete?id=" + id;
            $.getJSON(url, function (data) {
                if (data.State === 200) {
                    layer.msg(data.Msg);
                    $(".layui-laypage-btn")[0].click();
                }
                else {
                    layer.msg(data.Message);
                }
            });
        }, function () {

        });
    }
</script> 


